Render hunt-page ruleset tracking and hunt provenance fields - #266
Render hunt-page ruleset tracking and hunt provenance fields#266vhmartinezm wants to merge 5 commits into
Conversation
Two formatter legs, both getattr-guarded so the CLI still renders results parsed by an SDK release that predates the fields: - ruleset: Favorite / Favorited at, Rules in ruleset (absent when the server had no answer — never shown as 0), Historical hunts triggered, and New live results in window (only when the caller asked the list to include counts). - hunt: Source Ruleset Id, the source's last-modified at freeze time, and 'Source ruleset changed since this hunt froze it: yes/no' — the label names the reference point deliberately; unknown prints nothing.
The getattr guards (an old-SDK result without the attributes renders, new lines omitted), zero-distinct-from-absent for the counters, the truthy-only favorite leg, and the reference point in the changed-since-freeze label.
Maps to the server's include_counts so the 'New live results in window' formatter leg is reachable from the CLI (only live-hunting rulesets carry a count; the param is omitted unless asked).
The flag must reach ruleset_list(include_counts=True) and the unflagged run must omit the param entirely — the SDK drops None, and the exact wire value is load-bearing (the server only accepts '0'/'1'/'false'/ 'true').
|
Review. Base is 1. Blocking — The formatter legs are
CI will be green (the SDK branch name matches this branch, so the archive install picks up 321), which is why this needs catching in review rather than from a red pipeline.
Two ways out:
(The 2. The new mock hides exactly that failure (
3. Formatter tests use SimpleNamespace, so field renames fail silently ( Every new line is 4. Spec drift — no spec touched AGENTS.md, step 6: "Update the specs for the area you touched (at least 02-commands.md) in the same PR." 5. Minor (
|
…sources Review findings: - Blocking: the unconditional include_counts= kwarg made plain 'rules list' a hard dependency on an SDK newer than the pin's floor — 4.3.0's ruleset_list takes no arguments, so every unflagged run would TypeError against the published SDK (CI could not see it: the branch archive install picks up the new SDK). The kwargs are now built conditionally; only --include-counts requires the new SDK, matching the degradation claim the PR body makes. - The flag tests now autospec the mock, turning both assertions into signature checks against the installed SDK — the check that would have caught the above locally. - The rendering tests build REAL SDK resources from literal dicts, so an SDK attribute rename fails the test instead of silently dropping a line (the getattr guards convert mismatches into omission); they also pin that favorited_at/rule_modified arrive as parsed datetimes. SimpleNamespace remains only for the old-SDK degradation cases, where absent attributes are the point. - specs/02-commands.md documents the new flag and the floor-SDK constraint; specs/03-formatters.md records the non-obvious rendering semantics (0-vs-None, truthy-only favorite, the tri-state and its reference point). Dead 'is not None' half of the favorite guard dropped.
Review — hunt-page tracking fieldsTwo things need action; the formatter legs themselves look right. 1.
|
|
All five addressed in ff1dc77: the blocking one is fixed as suggested — the kwargs are built conditionally, so plain |
TL;DR
Render the new hunt-page ruleset tracking and hunt provenance fields the SDK now parses. Two formatter legs, both
getattr-guarded so the CLI keeps rendering results parsed by an SDK release that predates the fields.Requires
What's new
ruleset:Favorite: yes(+Favorited at),Rules in ruleset(omitted when the server had no answer — never shown as 0),Historical hunts triggered, andNew live results in window(only when the caller asked the list to include counts).hunt:Source Ruleset Id, the source's last-modified at freeze time, andSource ruleset changed since this hunt froze it: yes/no— the label names the reference point deliberately; unknown prints nothing.No version-pin bump: the
getattrguards are exactly the degradation path for the currentpolyswarm_api>=4.3.0,<5.0.0range.Tests
tests/formatter_hunt_fields_test.pypins the guards (old-SDK results render, new lines omitted), zero-distinct-from-absent for the counters, the truthy-only favorite leg, and the reference point in the changed-since-freeze label.